////////////////////////////////////////////////////////////////////////////////
//  COPYRIGHT (C) 2010 TELECOM DIGITAL MEDIA ("TDMEDIA").
//  ALL RIGHTS RESERVED.
//
//  THIS IS CONFIDENTIAL AND PROPRIETARY INTELLECTUAL PROPERTY OWNED BY AND
//  CREATED ON BEHALF OF TDMEDIA. ANY FORM OF DISTRIBUTION, COPY,
//  MODIFICATION WITHOUT THE WRITTEN CONSENT FROM TDMEDIA IS STRICTLY
//  PROHIBITED.
////////////////////////////////////////////////////////////////////////////////
package cc.telecomdigital.tdstock.activity.groups.more;

import android.os.Bundle;
import android.text.util.Linkify;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import cc.telecomdigital.tdstock.CommonDefn;
import cc.telecomdigital.tdstock.ITDLApplication;
import cc.telecomdigital.tdstock.R;
import cc.telecomdigital.tdstock.Framework.UniqueItem.TDStockLog;
import cc.telecomdigital.tdstock.Tools.ActivityGroupController;
import cc.telecomdigital.tdstock.activity.BaseActivity;
import cc.telecomdigital.tdstock.activity.groups.MoreGroup;

/**
 * @author ouyangzhihui for list item named "WarrantsItemContent"
 */
public class WarrantsItemCommonContentActivity extends BaseActivity
{
	protected static final String	TAG	= WarrantsItemCommonContentActivity.class.getSimpleName();
	public static String			_content;
	public static String			_title;
	public static String			_timeStamp;
	public static String			_newsTitle;
	// public static Class<? extends Activity> _cls;

	private TextView				_txt;
	private TextView				_titleTextView;
	private Button					_toolBtnReturn;

	private TextView				_timestamp_tv;
	private TextView				_title_tv;

	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.more_common_content_warrants);

		_toolBtnReturn = (Button) findViewById(R.id.more_returnbtn);
		_toolBtnReturn.setFocusable(true);
		_toolBtnReturn.setClickable(true);
		_toolBtnReturn.setOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View v)
			{
				TDStockLog.d(TAG, "close current activity and forwarding to the previous");
				((ITDLApplication) getApplicationContext()).putString(CommonDefn.ACTIVITY_CAME_FROM_KEY, TAG);

				// Intent intent = new Intent(getApplicationContext(), _cls);
				// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
				// Intent.FLAG_ACTIVITY_NO_USER_ACTION);
				// SwitchForwardActivity(_cls, intent);

				SwitchBackActivity();
			}
		});

		_txt = (TextView) findViewById(R.id.item_content);

		_timestamp_tv = (TextView) findViewById(R.id.content_timestamp);
		_title_tv = (TextView) findViewById(R.id.content_title);

		// _txt.setAutoLinkMask(Linkify.ALL);
		_txt.setAutoLinkMask(Linkify.WEB_URLS | Linkify.EMAIL_ADDRESSES);
		_titleTextView = (TextView) findViewById(R.id.more_menu_item_title);
	}

	@Override
	protected void onPause()
	{
		super.onPause();

		_timeStamp = null;
		_newsTitle = null;
	}

	@Override
	protected void onRestart()
	{
		super.onRestart();
	}

	@Override
	protected void onResume()
	{
		super.onResume();

		_titleTextView.setText(_title);
		_toolBtnReturn.setText(_title);

		_timestamp_tv.setText(_timeStamp);
		_title_tv.setText(_newsTitle);
		_txt.setText(_content);
	}

	@Override
	public ActivityGroupController GetActivityGroupController()
	{
		return MoreGroup.GetActivityGroupHostControl();
	}

}
